package cn.com.twoke.application.game.mario.core.ecs.component.render.shape;


import cn.com.twoke.application.game.mario.core.ecs.component.render.RenderComponent;
import cn.com.twoke.application.game.mario.core.ecs.component.render.RenderHandler;
import lombok.Builder;
import lombok.Data;

import java.awt.*;
import java.util.function.Supplier;

/**
 * 图形渲染
 */
@Data
@Builder
@RenderHandler(ShapeRenderComponentHandler.class)
public class ShapeRenderComponent implements RenderComponent {
    private Supplier<Shape> shape;
    @Builder.Default
    private boolean fill = true;
    @Builder.Default
    private Color color = Color.RED;
    @Builder.Default
    private Supplier<Boolean> isShow = () -> Boolean.TRUE;
    @Builder.Default
    public Integer index = 0;

    @Override
    public Boolean isDisplay() {
        return isShow.get();
    }

    public Shape getShape() {
        return shape.get();
    }
}
